#! /bin/bash

# ------------------------------------------
# 
# Created by Statemood, 2013.10.31 16:00
# Updated by Statemood, 2013.10.31 16:05
#            Statemood@gmail.com
#
# Project mgutils:
#    https://github.com/Statemood/nagios-plugs
# ------------------------------------------

status=`sestatus | grep 'SELinux status:' | awk '{print $3}'`
  mode=`sestatus | grep 'Current mode:'   | awk '{print $3}'`

if [ "$status" = "enabled" ]
then
    echo "OK - SELinux is Enabled, mode=$mode"
    exit 0
elif [ "$status" = "disabled" ]
then
    echo "CRITICAL - SELinux is Disabled, mode=$mode"
    exit 2
else
    echo "UNKNOWN - SELinux status is unknown"
    exit 3
fi
